package com.burmagateway.controller;

import java.util.Map;

import com.burmagateway.model.TourPackage;
import com.burmagateway.service.TourPackageService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@RequestMapping("/tourpackage/**")
@Controller
public class TourPackageController {
	
	@Autowired
	private TourPackageService tourPackageService;
	
	@RequestMapping("/CreatePackage")
	public String listTourPackages(Map<String,Object> map){
		map.put("tourpackage", new TourPackage());
		map.put("tourpackageList", tourPackageService.listTourPackages());
		
		return "TourPackage";
	}
	
	@RequestMapping(value="/add",method=RequestMethod.POST)
	public String addTourPackage(@ModelAttribute("TourPackage") TourPackage tourPackage,BindingResult result){
		tourPackageService.addTourPackage(tourPackage);
		return "tourpackage/CreatePackage";
	}	
	
}
